package com.casic.ops.entity.dto;

import com.casic.ops.entity.domain.ApplicationProfileDO;
import com.orion.utils.convert.TypeStore;
import lombok.Data;


/**
 * @ClassName ops-platform
 * @Description 应用环境缓存
 * @Author mianbin
 * @Date 2022/5/31 10:59
 * @Version 1.0
 **/
@Data
public class ApplicationProfileDTO {

    /**
     * id
     */
    private Long id;

    /**
     * 环境名称
     */
    private String profileName;

    /**
     * 环境标识
     */
    private String profileTag;

    public static ApplicationProfileDTO Dto2Do(ApplicationProfileDO p) {
        ApplicationProfileDTO dto = new ApplicationProfileDTO();
        dto.setId(p.getId());
        dto.setProfileName(p.getProfileName());
        dto.setProfileTag(p.getProfileTag());
        return dto;
    }

    static {
        TypeStore.STORE.register(ApplicationProfileDO.class, ApplicationProfileDTO.class, p -> {
            ApplicationProfileDTO dto = new ApplicationProfileDTO();
            dto.setId(p.getId());
            dto.setProfileName(p.getProfileName());
            dto.setProfileTag(p.getProfileTag());
            return dto;
        });
    }
}
